from django.db import models


# Create your models here.
# 男生  -> 女生
class Boy(models.Model):
    name = models.CharField(max_length=100)
    age = models.IntegerField()

    class Meta:
        db_table = 'boy'


# 女生  -> 男生
class Girl(models.Model):
    name = models.CharField(max_length=100)
    age = models.IntegerField()
    # boy  girl    on_delete=models.CASCADE  级联删除   girl 中 boy_id 只能是boy表中存在的id
    boy = models.OneToOneField(Boy, on_delete=models.CASCADE)

    class Meta:
        db_table = 'girl'
